
<h1><?php echo __('Users List') ?></h1>

<?php include_partial('global/searchForm', array('actionUrl'  => url_for('user/index'), 'formFilter' => $formFilter)) ?>
<?php if ($maxUser->getMaxUserRole()->canAdd()): ?>
    <a class="addNewItem right button noClear" href="<?php echo url_for('user/new') ?>'"><?php echo __('New') ?></a>
<?php endif; ?>
<table class="table adminGrid">
    <thead>
        <tr>
            <th><?php echo __('Username') ?></th>
            <th><?php echo __('Email') ?></th>
            <th><?php echo __('Role') ?></th>
            <th><?php echo __('Name') ?></th>
            <th><?php echo __('Photo') ?></th>
            <th><?php echo __('Need check') ?></th>
            <th><?php echo __('Statues') ?></th>
            <th><?php echo __('Edit') ?></th>
            <th><?php echo __('Delete') ?></th>
        </tr>
    </thead>
    <tbody>
        <?php foreach ($pager->getResults() as $user): ?>
            <tr>
                <td><?php echo $user->getUsername() ?></td>
                <td><?php echo $user->getEmail() ?></td>
                <td><?php echo $user->getRole() ?></td>
                <td><?php echo $user->getName() ?></td>
                <td><img src="<?php echo url_for('@RenderImage?type=us&width=100&height=90&imageName=' . $user->getPhoto()) ?>" /></td>
                <td><?php echo $user->getNeedCheck() ?></td>
                <td><?php echo $user->getStatuesTitle() ?></td>
                <?php if ($maxUser->getMaxUserRole()->canEdit()): ?>
                    <td><a href="<?php echo url_for('user/edit?id=' . $user->getId()) ?>"><?php echo __('edit') ?></a></td>
                <?php endif; ?>
                <?php if ($maxUser->getMaxUserRole()->canDelete()): ?>
                    <td><?php echo link_to(__('Delete'), 'user/delete?id=' . $user->getId(), array('method'  => 'delete', 'confirm' => __('Are you sure?'))) ?></td>
                <?php endif; ?>
            </tr>
        <?php endforeach; ?>
    </tbody>
</table>
<?php include_partial('global/pager', array('pager'     => $pager, 'routeName' => 'user')) ?>
<?php if ($maxUser->getMaxUserRole()->canAdd()): ?>
    <a href="<?php echo url_for('user/new') ?>"><?php echo __('New') ?></a>
<?php endif; ?>
